import {Injectable} from '@angular/core';
import {DefaultConfigService} from './default-config.service';
import {IConfig} from './config.interface';

@Injectable({
  providedIn: 'root'
})
export class ConfigService implements IConfig {
  // tslint:disable-next-line:variable-name
  private _host: string;
  get host() {
    return this._host || this.parent.host;
  }

  set host(v) {
    this._host = v;
  }

  // tslint:disable-next-line:variable-name
  private _port: number;
  get port() {
    return this._port || this.parent.port;
  }

  set port(v) {
    this._port = v;
  }

  constructor(private parent: DefaultConfigService) {
  }
}
